/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.jsc.app.controller;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Jeff
 */
@Controller
public class CategoriaController {

    private ModelAndView mostrar_categorias(ModelMap modelo){
        System.out.println("HOOOLASSS");
        Map<String, Object> datos = new HashMap<String, Object>();
        try {
            System.out.println("HOOOLASSS");
        } catch (Exception e) {
            e.printStackTrace();
        }

        return new ModelAndView("mostrar_categorias", datos);
    }

    @RequestMapping(value="/mostrar_categorias", method=RequestMethod.GET)
    public ModelAndView mostrar_categorias_GET(ModelMap modelo){
        return mostrar_categorias(modelo);
    }

    @RequestMapping(value="/mostrar_categorias", method=RequestMethod.POST)
    public ModelAndView mostrar_categorias_POST(ModelMap modelo){
        return mostrar_categorias(modelo);
    }



    private ModelAndView perfil(ModelMap modelo, HttpServletRequest request){
        Map<String, Object> datos = new HashMap<String, Object>();
        try {
            String url = request.getParameter("url_empresa");
            String param = request.getParameter("param");
            System.out.println("--->  URL : " + url + " ; param : " + param);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return new ModelAndView("mostrar_categorias", datos);
    }

    @RequestMapping(value="/perfil", method=RequestMethod.GET)
    public ModelAndView perfil_GET(ModelMap modelo, HttpServletRequest request){
        return perfil(modelo, request);
    }

    @RequestMapping(value="/perfil", method=RequestMethod.POST)
    public ModelAndView perfil_POST(ModelMap modelo, HttpServletRequest request){
        return perfil(modelo, request);
    }
}
